﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Threading.Tasks;

namespace water_pipe_repairing
{   
    enum BlockStatus
    {
        //水管的类型
        弯曲水管,
        直水管,
        阀门,
        墙,
    }

    enum Blockdirection
    {
        //水管当前状态
        上,
        下,
        左,
        右,
        横,
        竖,
        开,
        关,
    }
        
    class Block
    {
        /// <summary>
        /// 矩阵状态
        /// </summary>
        public BlockStatus status { get; set; }
        public Blockdirection direction { get; set; }
        /// <summary>
        /// 矩阵坐标
        /// </summary>
        public Point Point { get; set; }


        public Block(Point point,BlockStatus status,Blockdirection direction)
        {
            //初始状态为
            status = BlockStatus.弯曲水管;
            Point = point;
            direction = Blockdirection.上;
        }
        /// <summary>
        /// 画出当前格子
        /// </summary>
        /// <param name="g">绘图句柄</param>
        /// <param name="rec">当前block的rectangle</param>

        public void draw(Graphics g, Rectangle rec)
        {
            switch (status)
            {
                case BlockStatus.弯曲水管:
                    switch (direction)
                    {
                        case Blockdirection.上:
                            g.DrawImage(Properties.Resources.弯曲水管_上, rec);
                            break;
                        case Blockdirection.右:                          
                            g.DrawImage(Properties.Resources.弯曲水管_右, rec);                           
                            break;
                        case Blockdirection.下:
                            g.DrawImage(Properties.Resources.弯曲水管_下, rec);
                            break;
                        case Blockdirection.左:
                            g.DrawImage(Properties.Resources.弯曲水管_左, rec);
                            break;
                    }
                        break;
                case BlockStatus.直水管:
                    switch (direction)
                    {
                        case Blockdirection.横:                           
                            g.DrawImage(Properties.Resources.直水管_横, rec);
                            break;
                        case Blockdirection.竖:
                            g.DrawImage(Properties.Resources.直水管_竖, rec);
                            break;
                    }
                    break;
                case BlockStatus.阀门:
                    g.DrawImage(Properties.Resources.阀门, rec);
                    break;
                case BlockStatus.墙:
                    g.DrawImage(Properties.Resources.土墙, rec);
                    break;

            }
            
        }

    }
}
